using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects {
	public static class BO_portal_threads {
		public static DataTable SelectAll(int status) {
			try {
				usp_portal_threads_select_all entity = new usp_portal_threads_select_all();
				entity.STATUS = status;
				return BO_Actions<usp_portal_threads_select_all>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static DataTable SelectTop(int rows, int status) {
			try {
				usp_portal_threads_select_top entity = new usp_portal_threads_select_top();
				entity.NUMBERRECORD = rows;
				entity.STATUS = status;
				return BO_Actions<usp_portal_threads_select_top>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static DataTable Search(int thread_id) {
			try {
				usp_portal_threads_search entity = new usp_portal_threads_search();
				entity.THREAD_ID = thread_id;

				return BO_Actions<usp_portal_threads_search>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static DataTable SelectWithPaged(int startIndex, int pageCount, int status) {
			try {
				usp_portal_threads_select_paged entity = new usp_portal_threads_select_paged ();
				entity.STARTINDEX = startIndex;
				entity.MAXRECORDS = pageCount;
				entity.STATUS = status;
				return BO_Actions<usp_portal_threads_select_paged>.ExecuteAndReturnDataTable(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static string Insert( int category_id, Int64 member_id, int need_id, int region_id, int direction_id, string thread_code, int total_sms, int thread_up_quota, int total_up, int type_post, string thread_title, string thread_details, string thumb_img, int total_view, int total_comments, bool is_vip, decimal unit_price, decimal area, int unit_type_id, DateTime vip_start_date, DateTime vip_end_date, bool is_display_on_homepage, int order_display, int order_display_in_category, DateTime created_date, string created_by, DateTime modify_date, string modify_by, string last_comment_by, DateTime last_comment_date, bool status) {
			try {
				usp_portal_threads_insert entity = new usp_portal_threads_insert();
                entity.CATEGORY_ID = category_id;
                entity.MEMBER_ID = member_id;
                entity.NEED_ID = need_id;
                entity.REGION_ID = region_id;
                entity.DIRECTION_ID = direction_id;
                entity.THREAD_CODE = thread_code;
                entity.TOTAL_SMS = total_sms;
                entity.THREAD_UP_QUOTA = thread_up_quota;
                entity.TOTAL_UP = total_up;
                entity.TYPE_POST = type_post;
                entity.THREAD_TITLE = thread_title;
                entity.THREAD_DETAILS = thread_details;
                entity.THUMB_IMG = thumb_img;
                entity.TOTAL_VIEW = total_view;
                entity.TOTAL_COMMENTS = total_comments;
                entity.IS_VIP = is_vip;
                entity.UNIT_PRICE = unit_price;
                entity.AREA = area;
                entity.UNIT_TYPE_ID = unit_type_id;
                entity.VIP_START_DATE = vip_start_date;
                entity.VIP_END_DATE = vip_end_date;
                entity.IS_DISPLAY_ON_HOMEPAGE = is_display_on_homepage;
                entity.ORDER_DISPLAY = order_display;
                entity.ORDER_DISPLAY_IN_CATEGORY = order_display_in_category;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.LAST_COMMENT_BY = last_comment_by;
                entity.LAST_COMMENT_DATE = last_comment_date;
                entity.STATUS = status;

				return BO_Actions<usp_portal_threads_insert>.ExecuteAndReturnStringValue(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static string Update( Int64 thread_id, int category_id, Int64 member_id, int need_id, int region_id, int direction_id, string thread_code, int total_sms, int thread_up_quota, int total_up, int type_post, string thread_title, string thread_details, string thumb_img, int total_view, int total_comments, bool is_vip, decimal unit_price, decimal area, int unit_type_id, DateTime vip_start_date, DateTime vip_end_date, bool is_display_on_homepage, int order_display, int order_display_in_category, DateTime created_date, string created_by, DateTime modify_date, string modify_by, string last_comment_by, DateTime last_comment_date, bool status) {
			try {
				usp_portal_threads_update entity = new usp_portal_threads_update();
                entity.THREAD_ID = thread_id;
                entity.CATEGORY_ID = category_id;
                entity.MEMBER_ID = member_id;
                entity.NEED_ID = need_id;
                entity.REGION_ID = region_id;
                entity.DIRECTION_ID = direction_id;
                entity.THREAD_CODE = thread_code;
                entity.TOTAL_SMS = total_sms;
                entity.THREAD_UP_QUOTA = thread_up_quota;
                entity.TOTAL_UP = total_up;
                entity.TYPE_POST = type_post;
                entity.THREAD_TITLE = thread_title;
                entity.THREAD_DETAILS = thread_details;
                entity.THUMB_IMG = thumb_img;
                entity.TOTAL_VIEW = total_view;
                entity.TOTAL_COMMENTS = total_comments;
                entity.IS_VIP = is_vip;
                entity.UNIT_PRICE = unit_price;
                entity.AREA = area;
                entity.UNIT_TYPE_ID = unit_type_id;
                entity.VIP_START_DATE = vip_start_date;
                entity.VIP_END_DATE = vip_end_date;
                entity.IS_DISPLAY_ON_HOMEPAGE = is_display_on_homepage;
                entity.ORDER_DISPLAY = order_display;
                entity.ORDER_DISPLAY_IN_CATEGORY = order_display_in_category;
                entity.CREATED_DATE = created_date;
                entity.CREATED_BY = created_by;
                entity.MODIFY_DATE = modify_date;
                entity.MODIFY_BY = modify_by;
                entity.LAST_COMMENT_BY = last_comment_by;
                entity.LAST_COMMENT_DATE = last_comment_date;
                entity.STATUS = status;

				return BO_Actions<usp_portal_threads_update>.ExecuteAndReturnStringValue(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static bool Delete(string ids, string spliter, int delete_type) {
			try {
				usp_portal_threads_delete entity = new usp_portal_threads_delete();
				entity.IDS = ids;
				entity.SPLITER = spliter;
				entity.DELETE_TYPE = delete_type;

				return BO_Actions<usp_portal_threads_delete>.ExecuteAndReturnBooleanValue(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
		public static bool Restore(int thread_id) {
			try {
				usp_portal_threads_restore entity = new usp_portal_threads_restore();
				entity.THREAD_ID = thread_id;

				return BO_Actions<usp_portal_threads_restore>.ExecuteAndReturnBooleanValue(entity);
			} catch (Exception ex) {
				throw ex;
			}
		}
	}
}

